#include "stdafx.h"
#include "ECGFDAXMLConv.h"
#include "..\ECGFile.h"



extern "C" ECGFDAXML_DECL_SPEC int ECGFDAXMLConvert(char* lpECGFile, char* lpFDAXMLFile, char* lpLanguage, char* szErrorMsg)
{
	ECG_DATA_DEF* pECGData = new ECG_DATA_DEF;
	CECGFile::Create();
	if (!CECGFile::GetMe()->ECGReadFile(pECGData, lpECGFile)) {
		strcat(szErrorMsg, "Read ecg file failure.");
		CECGFile::Delete();
		
		return ECGFDAXML_READFILEFAILURE;
	}

	if (!CECGFile::GetMe()->ECGWriteFDAXMLFile(pECGData, lpFDAXMLFile, szErrorMsg)) {
		CECGFile::Delete();
		
		return ECGFDAXML_WRITEFILEEFAILURE;
	}
	CECGFile::Delete();
	delete pECGData;
	
	return ECGFDAXML_SUCCESS;
}
